﻿using GDGeek;
using MrPP.Myth;
using System;
using UnityEngine;

namespace MrPP.SerriedCabinet
{
    /*
    public class SerriedCabinetCtrl : GDGeek.Singleton<SerriedCabinetCtrl>, IBridgeReceiver
    {
        [SerializeField]
        BoxProcess _box;
        [SerializeField]
        SearchProcess _search;
        [SerializeField]
        WindowProcess _process;
        public void Start() {
            BridgeBroadcast.Instance.addReceiver(this);
        }
        public void OnDestory() {

            BridgeBroadcast.Instance.removeReceiver(this);
        }
        internal void init()
        {

        }
     //   [SerializeField]
      //  SetAsgardPose _anchor = null;
        private AsgardPoseData pose_ = null;
        
        public string handle => this.gameObject.longName();


        public void broadcast(string evt, object value)
        {
        //    _search.post(evt, value);
         //   _box.post(evt, value);
            /*
            Debug.Log("message:" + evt);
            if (evt == "anchor")
            {
                AsgardPoseData data = (AsgardPoseData)value;
                if (pose_ == null)
                {
                    _anchor._pose = data.aPose;
                    _process.doVuforia(_anchor.transform);
                }
                pose_ = data;
            }
            else if (evt == "touch")
            {
                if (pose_ != null)
                {
                    _anchor._pose = pose_.aPose;
                }
            }
            else if (evt == "qrcode")
            {
                _process.doQrcode((string)value);
            }
            else if (evt == "close")
            {
                _process.doClose();
            }
            else if (evt == "ventilate")
            {
                _process.doVentilate();
            }
            else if (evt == "stop")
            {
                _process.doStop();
            }
            else if (evt == "open")
            {
                _process.doOpen();
            }
            else if (evt == "open_id")
            {
                TaskManager.Run(BoxOperation.Instance.open((int)value));
               // _process.onOpen((int)value);
            }
            else if (evt == "select")
            {
                _process.doSelect((int)value);
            }
            else
            {
               
            }

}*/

    /*
    internal void post(Tuple<string, object> kv)
    {
        Debug.Log("message:"+kv.Item1);
        if (kv.Item1 == "anchor")
        {
            AsgardPoseData data = (AsgardPoseData)kv.Item2;
            if (pose_ == null)
            {
                _anchor._pose = data.aPose;
                _process.doVuforia(_anchor.transform);
            }
            pose_ = data;
        }
        else if (kv.Item1 == "touch") {
            if (pose_ != null)
            {
                _anchor._pose = pose_.aPose;
            }
        }
        else if (kv.Item1 == "qrcode")
        {
            _process.doQrcode((string)kv.Item2);
        }
        else if (kv.Item1 == "close")
        {
            _process.doClose();
        }
        else if (kv.Item1 == "ventilate")
        {
            _process.onVentilate();
        }
        else if (kv.Item1 == "stop")
        {
            _process.onStop();
        }
        else if (kv.Item1 == "open")
        {
            _process.onOpen();
        }
        else if (kv.Item1 == "open_id")
        {
            _process.onOpen((int)kv.Item2);
        }
        else if (kv.Item1 == "select")
        {
            _process.onSelect((int)kv.Item2);
        }
        else
        {
            _search.post(kv.Item1, kv.Item2);
            _box.post(kv.Item1, kv.Item2);
        }





    }


} 
*/
}